package demo11_1;

class OuterClass {
    public int data1 = 1;
    private int data2 = 2;
    public static int data3 = 3;
    //实例内部类
    class Innerclass {
        public int data4 = 4;
        private int data5 = 5;
        public final static int data6 = 6;
        public int data1 = 111;
        public void test() {
            System.out.println(data1);
            System.out.println(OuterClass.this.data1);
//            System.out.println(data4);
//            System.out.println(data5);
            System.out.println("内部类test方法");
        }
    }
    public void test() {
        System.out.println("外部类test方法");
    }
    public void method() {
        //局部内部类：定义在方法的内部
        class InnerClass4 {

        }
    }
}
public class Test11_2 {
    public static void main(String[] args) {
//        InnerClass innerClass = new InnerClass();
        OuterClass outerClass = new OuterClass();
//        System.out.println(outerClass.data1);
        OuterClass.Innerclass innerclass = outerClass.new Innerclass();
//        OuterClass.Innerclass innerclass = new OuterClass().new Innerclass();
        innerclass.test();
//        outerClass.test();

    }
}